package com.qfedu.yanglao20admin.advice.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qfedu.yanglao20.common.CommonResult;
import com.qfedu.yanglao20admin.advice.service.AdviceService;
import com.qfedu.yanglao20admin.advice.vo.AdviceVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * (Advice)表控制层
 *
 * @author makejava
 * @since 2023-04-19 20:02:46
 */

@Api(tags = "投诉意见控制器")
@RestController
@RequestMapping("advice")
public class AdviceController {
    /**
     * 服务对象
     */
    @Resource
    private AdviceService adviceService;


    @ApiOperation(value = "分页查询", notes = "分页查询")
    @GetMapping("page")
    public CommonResult<Page<AdviceVO>> selectPage(Integer current, Integer size) {
        if (current - 1 < 0) {
            return CommonResult.error("页码不合法");
        }
        return CommonResult.success(adviceService.advicePage((current - 1) * size, size));
    }
}

